package mx.kolobok.noteeditor.ui.keymap.actions;

import mx.kolobok.noteeditor.NoteManagerException;
import mx.kolobok.noteeditor.ui.list.NoteListModel;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * User:  Nikita Belenkiy
 * Date: 19.05.11
 * Time: 17:35
 */
public class NewNoteAction extends AbstractAction {
    private NoteListModel noteListModel;

    public NewNoteAction(NoteListModel noteListModel) {
        super("New note");
        this.noteListModel = noteListModel;
//        putValue(Action.MNEMONIC_KEY, KeyEvent.VK_N);
        putValue(Action.ACCELERATOR_KEY, Actions.NEW_NOTE_KEYSTROKE);

    }

    public void actionPerformed(ActionEvent e) {
        try {
            noteListModel.createDefaultNote();
        } catch (NoteManagerException e1) {
            e1.printStackTrace();
        }
    }
}
